let base = 16;
function resize() {
    const scale = document.documentElement.clientWidth / 1920;
    document.documentElement.style.fontSize = base * Math.min(scale, 2) + 'px'
}

resize();
window.onresize = () => {
    resize();
}